//
//  ICWebNavTitleView.m
//  ICome
//
//  Created by zhangrongwu on 2017/2/24.
//  Copyright © 2017年 iCom. All rights reserved.
//

#import "ICWebNavTitleView.h"
#import "ICHeaderFile.h"

@implementation ICWebNavTitleView

-(instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.status = YES;
        [self layoutSubview];
    }
    return self;
}

-(void)setStatus:(BOOL)status {
    _status = status;
    NSString *image = @"";
    if (self.status) {
        image = @"icon_application_down";
    } else {
        image = @"icon_application_up";
    }
    self.statusView.image = [UIImage imageNamedFromiComeSDKBundle:image];
    
}

- (void)layoutSubview {
    [self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.centerY.equalTo(self.mas_centerY);
    }];
    
    [self.statusView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleLabel.mas_right).offset(5);
        make.centerY.equalTo(self.mas_centerY);
    }];
}

-(UIImageView *)statusView {
    if (!_statusView) {
        _statusView = [[UIImageView alloc] init];
        _statusView.image = [UIImage imageNamedFromiComeSDKBundle:@"icon_application_down"];
        [self addSubview:_statusView];
    }
    return _statusView;
}

-(UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.font = [UIFont systemFontOfSize:18.0];//状态栏title
        _titleLabel.textColor = [UIColor blackColor];
        [self addSubview:_titleLabel];
    }
    return _titleLabel;
}

@end
